package com.misakyanls.examples;

import java.io.IOException;
/*import java.io.PrintStream;
import java.util.Iterator;
import java.util.Scanner;

import com.businessobjects.sdk.plugin.desktop.publication.IPublication;
import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.crystaldecisions.sdk.occa.infostore.IDestination;
import com.crystaldecisions.sdk.occa.infostore.IDestinationPlugin;
import com.crystaldecisions.sdk.occa.infostore.IDestinations;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
import com.crystaldecisions.sdk.occa.infostore.ISchedulingInfo;
import com.crystaldecisions.sdk.plugin.CeKind;
import com.crystaldecisions.sdk.plugin.CeProgID;
import com.crystaldecisions.sdk.plugin.destination.diskunmanaged.IDiskUnmanagedOptions;*/

public class BOETest {

	public static void main(String[] args) throws IOException/*, SDKException */{
		/*PrintStream os = System.out;
		Scanner in = new Scanner(System.in);

		String cms = "casper_so:6400";
		String username = "Administrator";
		os.println("Enter password");
		String password = in.nextLine();
		String authentication = "secEnterprise";
		ISessionMgr sm = null;
		IEnterpriseSession enterpriseSession = null;

		try {
			sm = CrystalEnterprise.getSessionMgr();
			enterpriseSession = sm.logon(username, password, cms, authentication);

			IInfoStore infoStore = (IInfoStore) enterpriseSession.getService("InfoStore");
			String queryString = "SELECT SI_NAME, SI_PUBLICATION_EVENT_HANDLERS, "
					+ "SI_SCHEDULEINFO, SI_DESTINATIONS FROM CI_INFOOBJECTS " + "WHERE SI_KIND = '" + CeKind.PUBLICATION
					+ "' and SI_INSTANCE = 0";
			IInfoObjects infoObjects = infoStore.query(queryString);

			IPublication publication = (IPublication) infoObjects.get(0);
			ISchedulingInfo schedulingInfo = publication.getSchedulingInfo();
			IDestinations destinations = schedulingInfo.getDestinations();

			IDestination diskDestination = (IDestination) destinations.get(0);
			String queryPlugin = "Select SI_DEST_SCHEDULEOPTIONS, SI_PROGID "
					+ "From CI_SYSTEMOBJECTS Where SI_PARENTID = 29 and " + "SI_NAME = '" + CeProgID.DISKUNMANAGED + "'";

			IInfoObjects plugins = infoStore.query(queryPlugin);
			IDestinationPlugin diskPlugin = (IDestinationPlugin) plugins.get(0);

			diskDestination.copyToPlugin(diskPlugin);
			IDiskUnmanagedOptions diskOptions = (IDiskUnmanagedOptions) diskPlugin.getScheduleOptions();

			@SuppressWarnings("rawtypes")
			Iterator filesIter = diskOptions.getDestinationFiles().iterator();
			while (filesIter.hasNext()) {
				String aFile = filesIter.next().toString();
				os.println(aFile);
			}

		} catch (SDKException e) {
			throw new Error("An error has occured: " + e.getMessage());
		} finally {
			enterpriseSession.logoff();
			enterpriseSession = null;
		}*/

	}

}
